package work.linruchang.util.bean.wrapper.db;

import java.io.Serializable;

/**
 * SQL片段
 *
 * @author LinRuChang
 * @version 1.0
 * @date 2022/01/14
 * @since 1.8
 **/
public class SqlFragment implements Serializable {

    public static final String SELECT = "SELECT";
    public static final String ASTERISK = "*";
    public static final String SELECT_COUNT = "COUNT(1)";

    public static final String FROM = "FROM";

    public static final String AS = "AS";


    public static final String LEFT_JOIN = "LEFT JOIN";
    public static final String INNER_JOIN = "INNER JOIN";
    public static final String RIGHT_JOIN = "RIGHT JOIN";

    public static final String ON = "ON";


    public static final String WHERE = "WHERE";
    public static final String WHERE_EQ = " {} = ? ";
    public static final String WHERE_LE = " {} <= ? ";
    public static final String WHERE_LT = " {} < ? ";
    public static final String WHERE_GE = " {} >= ? ";
    public static final String WHERE_GT = " {} > ?";
    public static final String WHERE_IN = " {} IN ({}) ";
    public static final String WHERE_NOT_IN = " {} NOT IN ({}) ";
    public static final String WHERE_BETWEEN_AND = " {} BETWEEN ? AND ? ";
    public static final String WHERE_LIKE = " {} LIKE ? ";
    public static final String WHERE_LIKE_LEFT = " {} LIKE '%{}' ";
    public static final String WHERE_LIKE_RIGHT = " {} LIKE '{}%' ";
    public static final String WHERE_AND = "AND";
    public static final String WHERE_NULL = "NULL";
    public static final String WHERE_EMPTY_VALUE = " ( IFNULL(LENGTH({}),0) = 0 ) ";
    public static final String WHERE_NOT_EMPTY_VALUE = " ( IFNULL(LENGTH({}),0) > 0 ) ";


    public static final String GROUP_BY = "GROUP BY";

    public static final String HAVING = "HAVING";

    public static final String ORDER_BY = "ORDER BY";
    public static final String DESC = "DESC";
    public static final String ASC = "ASC";

    public static final String LIMIT = "LIMIT";


}
